package com.xinsoft.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinsoft.entity.dto.SysConfigParam;
import com.xinsoft.entity.po.SysConfig;
import com.xinsoft.mapper.SysConfigMapper;
import com.xinsoft.service.SysConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author lijie
* @description 针对表【sys_config(系统配置信息表)】的数据库操作Service实现
* @createDate 2023-05-18 10:17:36
*/
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig>
    implements SysConfigService{

    @Resource
    SysConfigMapper configMapper;

    @Override
    public Object findPageListByParam(SysConfigParam param) {
        //分页
        Page<SysConfig> page = new Page<SysConfig>(param.getCurrentPage(), param.getPageSize());
        LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>();
        //查询条件
        queryWrapper
                .like(param.getParamKey()!=null,SysConfig::getParamKey,param.getParamKey());
        IPage<SysConfig> resultPage = configMapper.selectPage(page, queryWrapper);
        //返回值
        return resultPage;
    }
}




